define("pages/jls_cs/qjcsywtzmain", [
        "../../common/componts.js",
        "../../plugins/easyui/jquery-easyui-1.5.1/jquery.easyui.min.js",
        "../../plugins/easyui/jquery-easyui-1.5.1/locale/easyui-lang-zh_CN.js"
    ],
    function(require) {
        var comonts=require("../../common/componts");
        var kss=require("../../common/kss");
        var ywtzjbxxid="gwjjbId";
        var selectid;
        var id;
        var Select = function(){
            comonts.initSelectPage(undefined);
            comonts.initSelect(undefined,undefined,undefined);
        }
        var tableInit=function(){
            comonts.initTable(ywtzjbxxid,{
                url:"/jls_jbxx/jbxxList",
                title:'',
                width:'98.5%',
                fit:true,
                tools:'#ywtzyc',
                columns :  [
                    {
                        field: 'oid',
                        title: '序号',
                        formatter: function(value, rowData, rowIndex){
                            return '<input type="radio" name="ryRadio" id="ryRadio' + rowIndex + '" value="' + rowData.oid + '" />';
                        }},
                    {field : 'xm',title : '姓名',width : 150,sortable:'true',formatter: function(value,row,index){return '<span title='+(row.xm==null?"":row.xm)+'>'+(row.xm==null?"":row.xm)+'</span>'}},
                    {field : 'bm',title : '别名',width : 150,sortable:'true',formatter: function(value,row,index){return '<span title='+(row.bm==null?"":row.bm)+'>'+(row.bm==null?"":row.bm)+'</span>'}},

                    {field : 'qjly',title : '请假理由',width : 150,sortable:'true',formatter: function(value,row,index){return '<span title='+(row.ab==null?"":row.ab)+'>'+(row.ab==null?"":row.ab)+'</span>'}},
                    {field : 'zjqx',title : '准假期限',width : 150,sortable:'true',formatter: function(value,row,index){return '<span title='+(row.bahjString==null?"":row.bahjString)+'>'+(row.bahjString==null?"":row.bahjString)+'</span>'}},
                    {field : 'lsrq',title : '离所日期',width : 150,sortable:'true',formatter: function(value,row,index){return '<span title='+(row.rsrq==null?"":row.rsrq)+'>'+(row.rsrq==null?"":row.rsrq)+'</span>'}},
                    {field:'operate',title:'详细信息',align:'center',width : 60,/*width:$(this).width()*0.15,*/
                        formatter:function(value, row, index){
                            var str = '<a href="#" data-target="#ckPhoto"  name="opera" data-toggle="modal" class="easyui-linkbutton"><img src="../../img/xq.png"></a>';
                            return str;
                            //return  '<button id="sh_add" onclick="add"  > 不通过</button>'
                        }
                    }
                ] ,
                //基本信息双击事件
                onDblClickRow:function(rowIndex, rowData){
                    $("input[name='ryRadio']")[rowIndex].checked = true;
                    $("#"+ywtzjbxxid).datagrid("selectRow", rowIndex);
                    selectid=rowData.id;
                },

                onLoadSuccess:function(data){
                    if(data.total>0){
                        $('#'+ywtzjbxxid).datagrid("selectRow", 0);
                        $("input[name='ryRadio']")[0].checked = true;
                    }
                    /*$("a[name='opera']").on('click',function(){
                        var jbxx = $('#'+ywtzjbxxid).datagrid("getSelected");
                        kss.initJbxxxx(jbxx.gcbh,jbxx.rybh,jbxx.xm+"--详细信息");
                    });*/

                },
                //单击行选中取消事件
                onClickRow:function(rowIndex, rowData){
                    if(selectid!=rowData.id){
                        $("input[name='ryRadio']")[rowIndex].checked = true;
                        selectid=rowData.id;
                    }else{
                        $("#"+ywtzjbxxid).datagrid("unselectRow",rowIndex);
                        $("input[name='ryRadio']")[rowIndex].checked = false;
                        $('#'+ywtzjbxxid).datagrid('clearSelections');
                        selectid="";
                    }
                    kss.zjryClick(rowData);
                },
                onSelect:function(rowIndex, rowData){
                },
                rightmenu:function(){
                    //kss.initJbxxRightMenu(jbxxrightmenuid);
                },
            });


            //页面高度自适应
            $('#'+ywtzjbxxid).datagrid('resize',{
                height:($(window).height()-200),
            });
        }
        var findJbxx=function(){
            $('#'+ywtzjbxxid).datagrid('clearSelections');
            $('#'+ywtzjbxxid).datagrid('load',{
                'state':'R8',
            });
        }


        var bindAction=function(){

            $("#ywtz_search").on("click",function(){
                findJbxx();
            });

            $("#ywtz_tzdy").on("click",function () {
                alert("台账打印")
            });
            $("#ywtz_dcexcel").on("click",function(){
                alert("导出excel")
            });

            $(window).keydown(function(event) {
                if (event.keyCode == 13) {
                    findJbxx();
                }
            });


            //重置按钮
            $("#ryxxreset").on("click",function(){
                $("#txtjxm").val('');

            })

            $("#ts_query").on("click",function(){
                var xm = $("#tjtxxm").textbox("getValue");
                var type=$("input[name=radio1]:checked").val();
                if(xm){

                }else{
                    $.messager.alert("提示","请输入条形码或姓名");
                }
            })

        }
        var initView=function(){
            tableInit();
            bindAction();
            Select();
        }
        initView();
    });
